package com.xhh.nphm.web.controller.system;

import com.xhh.nphm.common.core.controller.BaseController;
import com.xhh.nphm.common.utils.DateUtils;
import com.xhh.nphm.system.domain.UserOperationLog;
import com.xhh.nphm.system.service.UserOperationLogService;
import com.xhh.nphm.web.controller.common.CommonController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Program: hw-zhuanban
 * @ClassName UserOperationLogController
 * @Author: liutao
 * @Description: 用户操作日志web接口
 * @Create: 2022-08-02 15:12
 * @Version 1.0
 **/
@Controller
@RequestMapping("/system/user")
public class UserOperationLogController extends BaseController {
    @Autowired
    private UserOperationLogService userOperationLogService;
    /**
     * @methodName: add
     * @description: 添加操作日志web接口
     * @Author LiuTao
     * @param  [operation]
     * @updateTime 2022/8/3 13:13
     * @return java.lang.Object
     * @throws
     **/
    @RequestMapping("/operation")
    @ResponseBody
    public Object add(String operation){
//        System.out.println(getSysUser());
        int num = userOperationLogService.add(new UserOperationLog(getSysUser().getLoginName(), operation, DateUtils.getNowDate()));
        if(num==1){
            return "操作日志记录成功";
        }else {
            return "操作日志记录成功";
        }
    }
}
